package VideoGameDatabase;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import oracle.jdbc.pool.OracleDataSource;
//import javax.swing.*;
/**
* Servlet implementation class OracleServlet
*/
public class oracleServelet extends HttpServlet {
private static final long serialVersionUID = 1L;
private static final String connect_string =
"jdbc:oracle:thin:jcs2137/raiden26@//w4111c.cs.columbia.edu:1521/ADB";
private Connection conn;
/**
* @see HttpServlet#HttpServlet()
*/
/*public oracleServelet() {
	super();
// TODO Auto-generated constructor stub
}*/
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
	throws ServletException, IOException {
	PrintWriter pw = new PrintWriter(response.getOutputStream());
	//databaseStartpage start = new databaseStartpage();
	//start.showButtons();
	try {
		if (conn == null) {
// Create a OracleDataSource instance and set URL
			OracleDataSource ods = new OracleDataSource();
			ods.setURL(connect_string);
			conn = ods.getConnection();
		}
		Statement stmt = conn.createStatement();
		//ResultSet rset = stmt.executeQuery("select title from VideoGame");
		response.setContentType("text/html");
		pw.println("<html>");
		pw.println("<head><title>Video Game ServletSample</title></head>");
		//pw.println("<H1>VideoGameDatabaseResults</H1>");
		//pw.println("<INPUT TYPE=\"checkbox\" NAME=\"Title\" VALUE=\"on\">");
		pw.println("<body>");
		pw.println("<img src=\"databaseLogo.jpg\" height=\"149\" width=\"410\">");
		pw.println("<TABLE>");
		
		int platformFlag = 0;
		int ratingFlag = 0;
		String result;
		if((result = request.getParameter("platform")) != null)
		{
			//String result = request.getParameter("platform");
			//pw.println();
			if(result.trim().equals("ps3"))
			{
				platformFlag = 1;
			}
			else if(result.equals("xbox360"))
			{
				platformFlag = 2;
			}
			else if(result.equals("multi"))
			{
				platformFlag = 3;
			}
			else if(result.equals("all"))
			{
				platformFlag = 0;
			}
		}
		
		if((result = request.getParameter("rating")) != null)
		{
			if(result.equals("allrating"))
				ratingFlag = 0;
			
			else if(result.equals("everyone"))
				ratingFlag = 1;
			
			else if(result.equals("teen"))
				ratingFlag = 2;
			
			else if(result.equals("mature"))
				ratingFlag = 3;
		}
		//pw.println(platformFlag);
		ResultSet rset = null;
		
		//TITLE
		if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") == null 
				&& request.getParameter("Company") == null 
				&& request.getParameter("Release") == null
				&& request.getParameter("CriticRating") == null
				&& request.getParameter("Awards") == null)
		{
			pw.println("<tr><td>TITLE</td></tr>"
					+ "<tr><td>------------</td></tr>");
			switch (platformFlag) {
			case 0:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select title from VideoGame");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title from VideoGame v, ESRBrating e where e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title from VideoGame v, ESRBrating e where e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title from VideoGame v, ESRBrating e where e.title = v.title and e.maturity = 'MATURE'");
				break;
			
			case 1:
				if(ratingFlag ==0)
					rset = stmt.executeQuery("select v.title from VideoGame v, MadeFor m where v.title = m.title AND m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Playstation 3'" +
							" and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Playstation 3'" +
					" and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Playstation 3'" +
					" and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title from VideoGame v, MadeFor m where v.title = m.title AND m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Xbox 360'" +
							" and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Xbox 360'" +
					" and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Xbox 360'" +
					" and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 3:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title from VideoGame v, MadeFor m where v.title = m.title AND m.consoleName = 'Xbox 360'" +
						"INTERSECT select v2.title from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Xbox 360' and v.title = e.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Xbox 360' and v.title = e.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Xbox 360' and v.title = e.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select title from VideoGame");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title from VideoGame v, ESRBrating e where e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title from VideoGame v, ESRBrating e where e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title from VideoGame v, ESRBrating e where e.title = v.title and e.maturity = 'MATURE'");
				break;
			}
				
			
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td></tr>");
			}
		}
		
		//TITLE, CRITICRATING
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") == null 
				&& request.getParameter("Company") == null 
				&& request.getParameter("Release") == null
				&& request.getParameter("CriticRating") != null
				&& request.getParameter("Awards") == null)
		{
			pw.println("<tr><td>TITLE</td><td>CRITIC RATING</td></tr>"
					+ "<tr><td>------------</td><td>------------</td></tr>");
			switch (platformFlag) {
			case 0:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, c.compScore from VideoGame v, CriticRating c where v.title = c.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, c.compScore from VideoGame v, ESRBrating e, CriticRating c where v.title = c.title and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, c.compScore from VideoGame v, ESRBrating e, CriticRating c where v.title = c.title and e.title = v.title and e.maturity = 'MATURE'");
				break;
			
			case 1:
				if(ratingFlag ==0)
					rset = stmt.executeQuery("select v.title, c.compScore from VideoGame v, MadeFor m, CriticRating c where v.title = c.title and v.title = m.title AND m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where v.title = c.title and v.title = m.title AND m.consoleName = 'Playstation 3'" +
							" and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where v.title = c.title and v.title = m.title AND m.consoleName = 'Playstation 3'" +
					" and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where v.title = c.title and v.title = m.title AND m.consoleName = 'Playstation 3'" +
					" and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, c.compScore from VideoGame v, MadeFor m, CriticRating c where v.title = c.title and v.title = m.title AND m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where v.title = c.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
							" and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where v.title = c.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
					" and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where v.title = c.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
					" and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 3:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, c.compScore from VideoGame v, MadeFor m, CriticRating c where v.title = c.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
						"INTERSECT select v2.title, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where v.title = c.title and v.title = m.title AND m.consoleName = 'Xbox 360' and v.title = e.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where v.title = c.title and v.title = m.title AND m.consoleName = 'Xbox 360' and v.title = e.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where v.title = c.title and v.title = m.title AND m.consoleName = 'Xbox 360' and v.title = e.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, c.compScore from VideoGame v, CriticRating c where c.title = v.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, c.compScore from VideoGame v, ESRBrating e, CriticRating c where e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, c.compScore from VideoGame v, ESRBrating e, CriticRating c where e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, c.compScore from VideoGame v, ESRBrating e, CriticRating c where e.title = v.title and e.maturity = 'MATURE'");
				break;
			}
				
			
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td><td>" + rset.getDouble("compScore") + "</td></tr>");
			}
		}
		
		//TITLE, AWARDS
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") == null 
				&& request.getParameter("Company") == null 
				&& request.getParameter("Release") == null
				&& request.getParameter("CriticRating") == null
				&& request.getParameter("Awards") != null)
		{
			pw.println("<tr><td>TITLE</td><td>AWARD</td><td>AWARD YEAR</td></tr>"
					+ "<tr><td>------------</td><td>------------</td><td>------------</td></tr>");
			switch (platformFlag) {
			case 0:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, a.awardName, a.year from VideoGame v, Awards a where v.title = a.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = v.title and e.maturity = 'MATURE'");
				break;
			
			case 1:
				if(ratingFlag ==0)
					rset = stmt.executeQuery("select v.title, a.awardName, a.year from VideoGame v, Awards a, MadeFor m where v.title = a.title and v.title = m.title AND m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Playstation 3'" +
					" and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, a.awardName, a.year from VideoGame v, Awards a, MadeFor m where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
							" and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
					" and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
					" and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 3:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, a.awardName, a.year from VideoGame v, Awards a, MadeFor m where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
						"INTERSECT select v2.title, a2.awardName, a2.year from VideoGame v2, Awards a2, MadeFor m2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and v.title = e.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, a2.awardName, a2.year from VideoGame v2, Awards a2, MadeFor m2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and v.title = e.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, a2.awardName, a2.year from VideoGame v2, Awards a2, MadeFor m2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and v.title = e.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title, a2.awardName, a2.year from VideoGame v2, Awards a2, MadeFor m2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, a.awardName, a.year from VideoGame v, Awards a where v.title = a.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = v.title and e.maturity = 'MATURE'");
				break;
			}
				
			
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td><td>" + rset.getString("awardName") + "</td><td>" + rset.getInt("year") + "</td></tr>");
			}

		}
		
		//TITLE, RELEASE DATE
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") == null 
				&& request.getParameter("Company") == null 
				&& request.getParameter("Release") != null
				&& request.getParameter("CriticRating") == null
				&& request.getParameter("Awards") == null)
		{
			pw.println("<tr><td>TITLE</td><td>RELEASE DATE</td></tr>"
					+ "<tr><td>------------</td><td>------------</td></tr>");
			switch (platformFlag) {
			case 0:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select title, releaseDate from VideoGame");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select title, releaseDate from VideoGame, ESRBrating e where e.title = t.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select title, releaseDate from VideoGame, ESRBrating e where e.title = t.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select title, releaseDate from VideoGame, ESRBrating e where e.title = t.title and e.maturity = 'MATURE'");
				break;
				
			case 1:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.releaseDate from VideoGame v, MadeFor m where v.title = m.title and m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Playstation 3'" +
							" and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Playstation 3'" +
					" and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Playstation 3'" +
					" and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.releaseDate from VideoGame v, MadeFor m where v.title = m.title and m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.releaseDate from VideoGame v, MadeFor m. ESRBrating e where v.title = m.title and m.consoleName = 'Xbox 360'" +
							" and e.title = t.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.releaseDate from VideoGame v, MadeFor m. ESRBrating e where v.title = m.title and m.consoleName = 'Xbox 360'" +
					" and e.title = t.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.releaseDate from VideoGame v, MadeFor m. ESRBrating e where v.title = m.title and m.consoleName = 'Xbox 360'" +
					" and e.title = t.title and e.maturity = 'MATURE'");
				break;
				
			case 3:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.releaseDate from VideoGame v, MadeFor m where v.title = m.title AND m.consoleName = 'Xbox 360'" +
					"INTERSECT select v2.title, v2.releaseDate from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, v2.releaseDate from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, v2.releaseDate from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title, v2.releaseDate from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select title, releaseDate from VideoGame");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select title, releaseDate from VideoGame, ESRBrating e where e.title = t.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select title, releaseDate from VideoGame, ESRBrating e where e.title = t.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select title, releaseDate from VideoGame, ESRBrating e where e.title = t.title and e.maturity = 'MATURE'");
				break;
				
			}
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td><td>" + rset.getInt("releaseDate") + "</td></tr>");
			}
		}
		//TITLE, RELEASE DATE, CRITICRATING
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") == null 
				&& request.getParameter("Company") == null 
				&& request.getParameter("Release") != null
				&& request.getParameter("CriticRating") != null
				&& request.getParameter("Awards") == null)
		{
			pw.println("<tr><td>TITLE</td><td>RELEASE DATE</td><td>CRITIC RATING</td></tr>"
					+ "<tr><td>------------</td><td>------------</td><td>------------</td></tr>");
			switch (platformFlag) {
			case 0:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore from VideoGame v, CriticRating c where c.title = v.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and c.title = v.title and e.title = t.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 1:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore from VideoGame v, MadeFor m, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where v.title = m.title and m.consoleName = 'Playstation 3'" +
							" and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3'" +
					" and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3'" +
					" and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore from VideoGame v, MadeFor m, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore from VideoGame v, MadeFor m. ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360'" +
							" and e.title = t.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore from VideoGame v, MadeFor m. ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360'" +
					" and e.title = t.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore from VideoGame v, MadeFor m. ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360'" +
					" and e.title = t.title and e.maturity = 'MATURE'");
				break;
				
			case 3:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore from VideoGame v, MadeFor m, CriticRating c where c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
					"INTERSECT select v2.title, v2.releaseDate, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, v2.releaseDate, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, v2.releaseDate, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title, v2.releaseDate, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore from VideoGame v, CriticRating c where c.title = v.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and c.title = v.title and e.title = t.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and e.title = t.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and e.title = t.title and e.maturity = 'MATURE'");
				break;
				
			}
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td><td>" + rset.getInt("releaseDate") + "</td><td>" + rset.getDouble("compScore") + "</td></tr>");
			}
		}
		
		//TITLE, COMPANY
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") == null 
				&& request.getParameter("Company") != null
				&& request.getParameter("Release") == null
				&& request.getParameter("CriticRating") == null
				&& request.getParameter("Awards") == null)
		{
			pw.println("<tr><td>TITLE</td><td>COMPANY</td></tr>"
					+ "<tr><td>------------</td><td>------------</td></tr>");
			switch (platformFlag) {
			case 0:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select title, compName from VideoGame");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName from VideoGame v, ESRBrating e where e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName from VideoGame v, ESRBrating e where e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName from VideoGame v, ESRBrating e where e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 1:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName from VideoGame v, MadeFor m where v.title = m.title and m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName from VideoGame v, MadeFor m where v.title = m.title and m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 3:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName from VideoGame v, MadeFor m where v.title = m.title AND m.consoleName = 'Xbox 360'" +
					"INTERSECT select v2.title, v2.compName from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, v2.compName from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, v2.compName from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title, v2.compName from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select title, compName from VideoGame");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName from VideoGame v, ESRBrating e where e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName from VideoGame v, ESRBrating e where e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName from VideoGame v, ESRBrating e where e.title = v.title and e.maturity = 'MATURE'");
				break;
			}
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td><td>" + rset.getString("compName") + "</td></tr>");
			}
		}
		
		//TITLE, COMPANY, CRITICRATING
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") == null 
				&& request.getParameter("Company") != null
				&& request.getParameter("Release") == null
				&& request.getParameter("CriticRating") != null
				&& request.getParameter("Awards") == null)
		{
			pw.println("<tr><td>TITLE</td><td>COMPANY</td><td>CRITIC RATING</td></tr>"
					+ "<tr><td>------------</td><td>------------</td><td>------------</td></tr>");
			switch (platformFlag) {
			case 0:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore from VideoGame v, CriticRating c where c.title = v.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 1:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore from VideoGame v, MadeFor m, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore from VideoGame v, MadeFor m, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 3:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore from VideoGame v, MadeFor m, CriticRating c where c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
					"INTERSECT select v2.title, v2.compName, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, v2.compName, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, v2.compName, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title, v2.compName, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore from VideoGame v, CriticRating c where c.title = v.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and e.title = v.title and e.maturity = 'MATURE'");
				break;
			}
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td><td>" + rset.getString("compName") + "</td><td>" + rset.getDouble("compScore") + "</td></tr>");
			}
		}
		
		//TITLE, COMPANY, RELEASE DATE
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") == null 
				&& request.getParameter("Company") != null
				&& request.getParameter("Release") != null
				&& request.getParameter("CriticRating") == null
				&& request.getParameter("Awards") == null)
		{
			pw.println("<tr><td>TITLE</td><td>COMPANY</td><td>RELEASE DATE</td></tr>"
					+ "<tr><td>------------</td><td>------------</td><td>------------</td></tr>");
			switch (platformFlag) {
			case 0:
			if(ratingFlag == 0)
				rset = stmt.executeQuery("select title, compName, releaseDate from VideoGame");
			else if(ratingFlag == 1)
				rset = stmt.executeQuery("select v.title, v.compName, releaseDate from VideoGame v, ESRBrating e where e.title = t.title and e.maturity = 'EVERYO'");
			else if(ratingFlag == 2)
				rset = stmt.executeQuery("select v.title, v.compName, releaseDate from VideoGame v, ESRBrating e where e.title = t.title and e.maturity = 'TEEN'");
			else if(ratingFlag == 3)
				rset = stmt.executeQuery("select v.title, v.compName, releaseDate from VideoGame v, ESRBrating e where e.title = t.title and e.maturity = 'MATURE'");
				break;
				
			case 1:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, releaseDate from VideoGame v, MadeFor m where v.title = m.title and m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Playstation 3'" +
							" and e.title = t.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Playstation 3'" +
					" and e.title = t.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Playstation 3'" +
					" and e.title = t.title and e.maturity = 'MATURE'");
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, releaseDate from VideoGame v, MadeFor m where v.title = m.title and m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Xbox 360'" +
							" and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Xbox 360'" +
					" and e.title = v.title and e.maturity = 'TEEN'");	
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Xbox 360'" +
					" and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 3:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate from VideoGame v, MadeFor m where v.title = m.title AND m.consoleName = 'Xbox 360'" +
					"INTERSECT select v2.title, v2.compName, v2.releaseDate from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, v2.compName, v2.releaseDate from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, v2.compName, v2.releaseDate from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title, v2.compName, v2.releaseDate from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select title, compName, releaseDate from VideoGame");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, releaseDate from VideoGame v, ESRBrating e where e.title = t.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, releaseDate from VideoGame v, ESRBrating e where e.title = t.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, releaseDate from VideoGame v, ESRBrating e where e.title = t.title and e.maturity = 'MATURE'");
				break;
				
			}
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td><td>" + rset.getString("compName") + "</td><td>" 
						+ rset.getInt("releaseDate") + "</td></tr>");
			}
		}
		//TITLE, COMPANY, RELEASE, CRITICRATING
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") == null 
				&& request.getParameter("Company") != null
				&& request.getParameter("Release") != null
				&& request.getParameter("CriticRating") != null
				&& request.getParameter("Awards") == null)
		{
			pw.println("<tr><td>TITLE</td><td>COMPANY</td><td>RELEASE DATE</td><td>CRITIC RATING</td></tr>"
					+ "<tr><td>------------</td><td>------------</td><td>------------</td><td>------------</td></tr>");
			switch (platformFlag) {
			case 0:
			if(ratingFlag == 0)
				rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, c.compScore from VideoGame v, CriticRating c where c.title = v.title");
			else if(ratingFlag == 1)
				rset = stmt.executeQuery("select v.title, v.compName, releaseDate, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and e.title = t.title and e.maturity = 'EVERYO'");
			else if(ratingFlag == 2)
				rset = stmt.executeQuery("select v.title, v.compName, releaseDate, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and e.title = t.title and e.maturity = 'TEEN'");
			else if(ratingFlag == 3)
				rset = stmt.executeQuery("select v.title, v.compName, releaseDate, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and e.title = t.title and e.maturity = 'MATURE'");
				break;
				
			case 1:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, releaseDate, c.compScore from VideoGame v, MadeFor m, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3'" +
							" and e.title = t.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3'" +
					" and e.title = t.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3'" +
					" and e.title = t.title and e.maturity = 'MATURE'");
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, releaseDate, c.compScore from VideoGame v, MadeFor m, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360'" +
							" and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360'" +
					" and e.title = v.title and e.maturity = 'TEEN'");	
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360'" +
					" and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 3:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, c.compScore from VideoGame v, MadeFor m, CriticRating c where c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
					"INTERSECT select v2.title, v2.compName, v2.releaseDate, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, v2.compName, v2.releaseDate, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, v2.compName, v2.releaseDate, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title, v2.compName, v2.releaseDate, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, c.compScore from VideoGame v, CriticRating c where c.title = v.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, releaseDate, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and e.title = t.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, releaseDate, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and e.title = t.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, releaseDate, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and e.title = t.title and e.maturity = 'MATURE'");
				break;
				
			}
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td><td>" + rset.getString("compName") + "</td><td>" 
						+ rset.getInt("releaseDate") + "</td><td>" 
						+ rset.getDouble("compScore") + "</td></tr>");
			}
		}
		//TITLE, GENRE
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") != null 
				&& request.getParameter("Company") == null
				&& request.getParameter("Release") == null
				&& request.getParameter("CriticRating") == null
				&& request.getParameter("Awards") == null)
		{
			pw.println("<tr><td>TITLE</td><td>GENRE</td></tr>"
					+ "<tr><td>------------</td><td>------------</td></tr>");
			switch (platformFlag) {
			case 0:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select title, genre from VideoGame");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre from VideoGame v, ESRBrating e where v.title = e.title AND e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre from VideoGame v, ESRBrating e where v.title = e.title AND e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre from VideoGame v, ESRBrating e where v.title = e.title AND e.maturity = 'MATURE'");
				break;
				
			case 1:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre from VideoGame v, MadeFor m where v.title = m.title and m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
				{
					rset = stmt.executeQuery("select v.title, v.genre from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Playstation 3'" +
							" v.title = e.title and e.maturity = 'EVERYO'");
				}
				else if(ratingFlag == 2)
				{
					rset = stmt.executeQuery("select v.title, v.genre from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Playstation 3'" +
					" v.title = e.title and e.maturity = 'TEEN'");
				}
				else if(ratingFlag == 3)
				{
					rset = stmt.executeQuery("select v.title, v.genre from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Playstation 3'" +
					" v.title = e.title and e.maturity = 'MATURE'");
				}
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre from VideoGame v, MadeFor m where v.title = m.title and m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
				{
					rset = stmt.executeQuery("select v.title, v.genre from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Xbox 360'" +
					" v.title = e.title and e.maturity = 'EVERYO'");
				}
				else if(ratingFlag == 2)
				{
					rset = stmt.executeQuery("select v.title, v.genre from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Xbox 360'" +
					" v.title = e.title and e.maturity = 'TEEN'");
				}
				else if(ratingFlag == 3)
				{
					rset = stmt.executeQuery("select v.title, v.genre from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Xbox 360'" +
					" v.title = e.title and e.maturity = 'MATURE'");
				}
				break;
				
			case 3:
				if(ratingFlag == 0)
				{
					rset = stmt.executeQuery("select v.title, v.genre from VideoGame v, MadeFor m where v.title = m.title AND m.consoleName = 'Xbox 360'" +
					"INTERSECT select v2.title, v2.genre from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				}
				else if(ratingFlag == 1)
				{
					rset = stmt.executeQuery("select v.title, v.genre from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Xbox 360' and v.title = e.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, v2.genre from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				}
				else if(ratingFlag == 2)
				{
					rset = stmt.executeQuery("select v.title, v.genre from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Xbox 360' and v.title = e.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, v2.genre from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				}
				else if(ratingFlag == 3)
				{
					rset = stmt.executeQuery("select v.title, v.genre from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Xbox 360' and v.title = e.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title, v2.genre from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				}
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select title, genre from VideoGame");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre from VideoGame v, ESRBrating e where v.title = e.title AND e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre from VideoGame v, ESRBrating e where v.title = e.title AND e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre from VideoGame v, ESRBrating e where v.title = e.title AND e.maturity = 'MATURE'");
				break;
			}
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td><td>" + rset.getString("genre") + "</td></tr>");
			}
		}
		//TITLE, GENRE, CRITICRATING
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") != null 
				&& request.getParameter("Company") == null
				&& request.getParameter("Release") == null
				&& request.getParameter("CriticRating") != null
				&& request.getParameter("Awards") == null)
		{
			pw.println("<tr><td>TITLE</td><td>GENRE</td><td>CRITIC RATING</td></tr>"
					+ "<tr><td>------------</td><td>------------</td><td>------------</td></tr>");
			switch (platformFlag) {
			case 0:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore from VideoGame v, CriticRating c where c.title = v.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and v.title = e.title AND e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore from VideoGame v, ESRBrating e, CriticRating c where v.title = e.title AND e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore from VideoGame v, ESRBrating e, CriticRating c where v.title = e.title AND e.maturity = 'MATURE'");
				break;
				
			case 1:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore from VideoGame v, MadeFor m, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
				{
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3'" +
							" v.title = e.title and e.maturity = 'EVERYONE'");
				}
				else if(ratingFlag == 2)
				{
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3'" +
					" v.title = e.title and e.maturity = 'TEEN'");
				}
				else if(ratingFlag == 3)
				{
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3'" +
					" v.title = e.title and e.maturity = 'MATURE'");
				}
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore from VideoGame v, MadeFor m, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
				{
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360'" +
					" v.title = e.title and e.maturity = 'EVERYO'");
				}
				else if(ratingFlag == 2)
				{
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360'" +
					" v.title = e.title and e.maturity = 'TEEN'");
				}
				else if(ratingFlag == 3)
				{
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360'" +
					" v.title = e.title and e.maturity = 'MATURE'");
				}
				break;
				
			case 3:
				if(ratingFlag == 0)
				{
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore from VideoGame v, MadeFor m, CriticRating c where c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
					"INTERSECT select v2.title, v2.genre, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				}
				else if(ratingFlag == 1)
				{
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360' and v.title = e.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, v2.genre, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				}
				else if(ratingFlag == 2)
				{
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360' and v.title = e.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, v2.genre, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				}
				else if(ratingFlag == 3)
				{
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360' and v.title = e.title and e.maturity = 'MATURITY'" +
					"INTERSECT select v2.title, v2.genre, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				}
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore from VideoGame v, CriticRating c where c.title = v.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and v.title = e.title AND e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore from VideoGame v, ESRBrating e, CriticRating c where v.title = e.title AND e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore from VideoGame v, ESRBrating e, CriticRating c where v.title = e.title AND e.maturity = 'MATURE'");
				break;
			}
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td><td>" + rset.getString("genre") + "</td><td>" + rset.getDouble("compScore") + "</td></tr>");
			}
		}
		
		//TITLE, GENRE, RELEASE DATE
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") != null 
				&& request.getParameter("Company") == null
				&& request.getParameter("Release") != null
				&& request.getParameter("CriticRating") == null
				&& request.getParameter("Awards") == null)
		{
			pw.println("<tr><td>TITLE</td><td>GENRE</td><td>RELEASE DATE</td></tr>"
					+ "<tr><td>------------</td><td>------------</td><td>------------</td></tr>");
			rset = stmt.executeQuery("select title, genre, releaseDate from VideoGame");
			switch (platformFlag) {
			case 0:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select title, genre, releaseDate from VideoGame");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate from VideoGame v, ESRBrating e where v.title = e.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate from VideoGame v, ESRBrating e where v.title = e.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate from VideoGame v, ESRBrating e where v.title = e.title and e.maturity = 'MATURE'");
				break;
				
			case 1:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate from VideoGame v, MadeFor m where v.title = m.title and m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate from VideoGame v, MadeFor m where v.title = m.title and m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 3:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate from VideoGame v, MadeFor m where v.title = m.title AND m.consoleName = 'Xbox 360'" +
					"INTERSECT select v2.title, v2.genre, v2.releaseDate from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, v2.genre, v2.releaseDate from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, v2.genre, v2.releaseDate from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title, v2.genre, v2.releaseDate from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select title, genre, releaseDate from VideoGame");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate from VideoGame v, ESRBrating e where v.title = e.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate from VideoGame v, ESRBrating e where v.title = e.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate from VideoGame v, ESRBrating e where v.title = e.title and e.maturity = 'MATURE'");
				break;
			}
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td><td>" + rset.getString("genre") + "</td><td>" 
						+ rset.getInt("releaseDate") + "</td></tr>");
			}
		}
		//TITLE, GENRE, RELEASE DATE, CRITICRATING
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") != null 
				&& request.getParameter("Company") == null
				&& request.getParameter("Release") != null
				&& request.getParameter("CriticRating") != null
				&& request.getParameter("Awards") == null)
		{
			pw.println("<tr><td>TITLE</td><td>GENRE</td><td>RELEASE DATE</td><td>CRITIC RATING</td></tr>"
					+ "<tr><td>------------</td><td>------------</td><td>------------</td><td>------------</td></tr>");
			rset = stmt.executeQuery("select title, genre, releaseDate from VideoGame");
			switch (platformFlag) {
			case 0:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore from VideoGame v, CriticRating c where c.title = v.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and v.title = e.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and v.title = e.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and v.title = e.title and e.maturity = 'MATURE'");
				break;
				
			case 1:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore from VideoGame v, MadeFor m, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore from VideoGame v, MadeFor m, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 3:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore from VideoGame v, MadeFor m, CriticRating c where c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
					"INTERSECT select v2.title, v2.genre, v2.releaseDate, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, v2.genre, v2.releaseDate, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, v2.genre, v2.releaseDate, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title, v2.genre, v2.releaseDate, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore from VideoGame v, CriticRating c where c.title = v.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and v.title = e.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and v.title = e.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and v.title = e.title and e.maturity = 'MATURE'");
				break;
			}
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td><td>" + rset.getString("genre") + "</td><td>" 
						+ rset.getInt("releaseDate") + "</td><td>" + rset.getDouble("compScore") + "</td></tr>");
			}
		}
		
		//TITLE, GENRE, COMPANY
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") != null 
				&& request.getParameter("Company") != null
				&& request.getParameter("Release") == null
				&& request.getParameter("CriticRating") == null
				&& request.getParameter("Awards") == null)
		{
			pw.println("<tr><td>TITLE</td><td>GENRE</td><td>COMPANY</td></tr>"
					+ "<tr><td>------------</td><td>------------</td><td>------------</td></tr>");
			switch (platformFlag) {
			case 0:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select title, genre, compName from VideoGame");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName from VideoGame v, ESRBRating e where e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName from VideoGame v, ESRBRating e where e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName from VideoGame v, ESRBRating e where e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 1:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName from VideoGame v, MadeFor m where v.title = m.title and m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName from VideoGame v, MadeFor m where v.title = m.title and m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 3:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title , v.genre, v.compName from VideoGame v, MadeFor m where v.title = m.title AND m.consoleName = 'Xbox 360'" +
					"INTERSECT select v2.title, v2.genre, v2.compName from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title , v.genre, v.compName from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, v2.genre, v2.compName from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title , v.genre, v.compName from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, v2.genre, v2.compName from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title , v.genre, v.compName from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title, v2.genre, v2.compName from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select title, genre, compName from VideoGame");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName from VideoGame v, ESRBRating e where e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName from VideoGame v, ESRBRating e where e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName from VideoGame v, ESRBRating e where e.title = v.title and e.maturity = 'MATURE'");
				break;
			}
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td><td>" + rset.getString("genre") + "</td><td>" + rset.getString("compName") 
						+ "</td></tr>");
			}
		}
		
		//TITLE, GENRE, COMPANY, CRITICRATING
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") != null 
				&& request.getParameter("Company") != null
				&& request.getParameter("Release") == null
				&& request.getParameter("CriticRating") != null
				&& request.getParameter("Awards") == null)
		{
			pw.println("<tr><td>TITLE</td><td>GENRE</td><td>COMPANY</td><td>CRITIC RATING</td></tr>"
					+ "<tr><td>------------</td><td>------------</td><td>------------</td><td>------------</td></tr>");
			switch (platformFlag) {
			case 0:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore from VideoGame v, CriticRating c where c.title = v.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore from VideoGame v, ESRBRating e, CriticRating c where c.title = v.title and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore from VideoGame v, ESRBRating e, CriticRating c where c.title = v.title and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore from VideoGame v, ESRBRating e, CriticRating c where c.title = v.title and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 1:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore from VideoGame v, MadeFor m, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore from VideoGame v, MadeFor m, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 3:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title , v.genre, v.compName, c.compScore from VideoGame v, MadeFor m, CriticRating c where c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
					"INTERSECT select v2.title, v2.genre, v2.compName, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title , v.genre, v.compName, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, v2.genre, v2.compName, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title , v.genre, v.compName, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, v2.genre, v2.compName, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title , v.genre, v.compName, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title, v2.genre, v2.compName, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore from VideoGame v, CriticRating c where c.title = v.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore from VideoGame v, ESRBRating e, CriticRating c where c.title = v.title and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore from VideoGame v, ESRBRating e, CriticRating c where c.title = v.title and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore from VideoGame v, ESRBRating e, CriticRating c where c.title = v.title and e.title = v.title and e.maturity = 'MATURE'");
				break;
			}
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td><td>" + rset.getString("genre") + "</td><td>" + rset.getString("compName") 
						+ "</td><td>" + rset.getDouble("compScore") + "</td></tr>");
			}
		}
		
		//TITLE, GENRE, COMPANY, RELEASE DATE
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") != null 
				&& request.getParameter("Company") != null
				&& request.getParameter("Release") != null
				&& request.getParameter("CriticRating") == null
				&& request.getParameter("Awards") == null)
		{
			pw.println("<tr><td>TITLE</td><td>GENRE</td><td>COMPANY</td><td>RELEASE DATE</td></tr>"
					+ "<tr><td>------------</td><td>------------</td><td>------------</td><td>------------</td></tr>");
			switch (platformFlag) {
			case 0:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select title, genre, compName, releaseDate from VideoGame");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate from VideoGame v, ESRBrating e where e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate from VideoGame v, ESRBrating e where e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate from VideoGame v, ESRBrating e where e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 1:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate from VideoGame v, MadeFor m where v.title = m.title and m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate from VideoGame v, MadeFor m where v.title = m.title and m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 3:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate from VideoGame v, MadeFor m where v.title = m.title AND m.consoleName = 'Xbox 360'" +
					"INTERSECT select v2.title, v2.genre, v2.compName, v2.releaseDate from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, v2.genre, v2.compName, v2.releaseDate from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, v2.genre, v2.compName, v2.releaseDate from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate from VideoGame v, MadeFor m, ESRBrating e where v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title, v2.genre, v2.compName, v2.releaseDate from VideoGame v2, MadeFor m2 where v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select title, genre, compName, releaseDate from VideoGame");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate from VideoGame v, ESRBrating e where e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate from VideoGame v, ESRBrating e where e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate from VideoGame v, ESRBrating e where e.title = v.title and e.maturity = 'MATURE'");
				break;
			}
			while (rset.next()) {
				pw.println ("<tr><td>" +rset.getString("title") + "</td><td>" + rset.getString("genre") + "</td><td>" 
						+ rset.getString("compName") + "</td><td>" + rset.getInt("releaseDate") + "</td></tr>");
			}
		}
		
		//TITLE, GENRE, COMPANY, RELEASE DATE, CRITICRATING
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") != null 
				&& request.getParameter("Company") != null
				&& request.getParameter("Release") != null
				&& request.getParameter("CriticRating") != null
				&& request.getParameter("Awards") == null)
		{
			pw.println("<tr><td>TITLE</td><td>GENRE</td><td>COMPANY</td><td>RELEASE DATE</td><td>CRITIC RATING</td></tr>"
					+ "<tr><td>------------</td><td>------------</td><td>------------</td><td>------------</td><td>------------</td></tr>");
			switch (platformFlag) {
			case 0:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore from VideoGame v, CriticRating c where c.title = v.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 1:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore from VideoGame v, MadeFor m, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore from VideoGame v, MadeFor m, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 3:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore from VideoGame v, MadeFor m, CriticRating c where c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
					"INTERSECT select v2.title, v2.genre, v2.compName, v2.releaseDate, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, v2.genre, v2.compName, v2.releaseDate, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, v2.genre, v2.compName, v2.releaseDate, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore from VideoGame v, MadeFor m, ESRBrating e, CriticRating c where c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title, v2.genre, v2.compName, v2.releaseDate, c2.compScore from VideoGame v2, MadeFor m2, CriticRating c2 where v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore from VideoGame v, CriticRating c where c.title = v.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore from VideoGame v, ESRBrating e, CriticRating c where c.title = v.title and e.title = v.title and e.maturity = 'MATURE'");
				break;
			}
			while (rset.next()) {
				pw.println ("<tr><td>" +rset.getString("title") + "</td><td>" + rset.getString("genre") + "</td><td>" 
						+ rset.getString("compName") + "</td><td>" + rset.getInt("releaseDate") + "</td><td>" + rset.getDouble("compScore") + "</td></tr>");
			}
		}
		
		
		
		//TITLE, CRITICRATING, AWARD
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") == null 
				&& request.getParameter("Company") == null 
				&& request.getParameter("Release") == null
				&& request.getParameter("CriticRating") != null
				&& request.getParameter("Awards") != null)
		{
			pw.println("<tr><td>TITLE</td><td>CRITIC RATING</td><td>AWARD</td><td>AWARD YEAR</td></tr>"
					+ "<tr><td>------------</td><td>------------</td><td>------------</td><td>------------</td></tr>");
			switch (platformFlag) {
			case 0:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, c.compScore, a.awardName, a.year from VideoGame v, CriticRating c, Awards a where v.title = c.title and v.title = a.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where v.title = c.title and v.title = a.title and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where v.title = c.title and v.title = a.title and e.title = v.title and e.maturity = 'MATURE'");
				break;
			
			case 1:
				if(ratingFlag ==0)
					rset = stmt.executeQuery("select v.title, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, CriticRating c, Awards a where v.title = c.title and v.title = a.title and v.title = m.title AND m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where v.title = c.title and v.title = a.title and v.title = m.title AND m.consoleName = 'Playstation 3'" +
							" and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where v.title = c.title and v.title = a.title and v.title = m.title AND m.consoleName = 'Playstation 3'" +
					" and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where v.title = c.title and v.title = a.title and v.title = m.title AND m.consoleName = 'Playstation 3'" +
					" and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, CriticRating c, Awards a where v.title = c.title and v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where v.title = c.title and v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
							" and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where v.title = c.title and v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
					" and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where v.title = c.title and v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
					" and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 3:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, CriticRating c, Awards a where v.title = c.title and v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
						"INTERSECT select v2.title, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = c2.title and v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where v.title = c.title and v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and v.title = e.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = c2.title and v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where v.title = c.title and v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and v.title = e.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = c2.title and v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where v.title = c.title and v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and v.title = e.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = c2.title and v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, c.compScore, a.awardName, a.year from VideoGame v, CriticRating c, Awards a where c.title = v.title and v.title = a.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where e.title = v.title and v.title = a.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where e.title = v.title and v.title = a.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where e.title = v.title and v.title = a.title and e.maturity = 'MATURE'");
				break;
			}
				
			
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td><td>" + rset.getDouble("compScore") + "</td><td>" + rset.getString("awardName") + "</td><td>" + rset.getInt("year") + "</tr></td>");
			}
		}
		
		
		
		
		//TITLE, RELEASE DATE, AWARD
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") == null 
				&& request.getParameter("Company") == null 
				&& request.getParameter("Release") != null
				&& request.getParameter("CriticRating") == null
				&& request.getParameter("Awards") != null)
		{
			pw.println("<tr><td>TITLE</td><td>RELEASE DATE</td><td>AWARD</td><td>AWARD YEAR</td></tr>"
					+ "<tr><td>------------</td><td>------------</td><td>------------</td><td>------------</td></tr>");
			switch (platformFlag) {
			case 0:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a where v.title = a.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = t.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = t.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = t.title and e.maturity = 'MATURE'");
				break;
				
			case 1:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m where v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'" +
							" and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'" +
					" and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'" +
					" and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m where v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360'" +
							" and e.title = t.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360'" +
					" and e.title = t.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360'" +
					" and e.title = t.title and e.maturity = 'MATURE'");
				break;
				
			case 3:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
					"INTERSECT select v2.title, v2.releaseDate, a2.awardName, a2.year from VideoGame v2, Awards a2, MadeFor m2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, v2.releaseDate, a2.awardName, a2.year from VideoGame v2, Awards a2, MadeFor m2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, v2.releaseDate, a2.awardName, a2.year from VideoGame v2, Awards a2, MadeFor m2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title, v2.releaseDate, a2.awardName, a2.year from VideoGame v2, Awards a2, MadeFor m2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a where v.title = a.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = t.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = t.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = t.title and e.maturity = 'MATURE'");
				break;
				
			}
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td><td>" + rset.getInt("releaseDate") + "</td><td>" + rset.getString("awardName") + "</td><td>" + rset.getInt("year") + "</td></tr>");
			}
		}
		
		
		
		
		//TITLE, RELEASE DATE, CRITICRATING, AWARD
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") == null 
				&& request.getParameter("Company") == null 
				&& request.getParameter("Release") != null
				&& request.getParameter("CriticRating") != null
				&& request.getParameter("Awards") != null)
		{
			pw.println("<tr><td>TITLE</td><td>RELEASE DATE</td><td>CRITIC RATING</td><td>AWARD</td><td>AWARD YEAR</td></tr>"
					+ "<tr><td>------------</td><td>------------</td><td>------------</td><td>------------</td><td>------------</td></tr>");
			switch (platformFlag) {
			case 0:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, CriticRating c, Awards a where c.title = v.title and v.title = a.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 1:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'" +
							" and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'" +
					" and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'" +
					" and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m. ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360'" +
							" and e.title = t.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m. ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360'" +
					" and e.title = t.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m. ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360'" +
					" and e.title = t.title and e.maturity = 'MATURE'");
				break;
				
			case 3:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
					"INTERSECT select v2.title, v2.releaseDate, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = c2.title and v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, v2.releaseDate, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = c2.title and v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, v2.releaseDate, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = c2.title and v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title, v2.releaseDate, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = c2.title and v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, CriticRating c, Awards a where c.title = v.title and v.title = a.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and e.title = t.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and e.title = t.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and e.title = t.title and e.maturity = 'MATURE'");
				break;
				
			}
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td><td>" + rset.getInt("releaseDate") + "</td><td>" + rset.getDouble("compScore") + "</td><td>" + rset.getString("awardName") + "</td><td>" + rset.getInt("year") + "</td></tr>");
			}
		}
		
		
		
		
		//TITLE, COMPANY, AWARD
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") == null 
				&& request.getParameter("Company") != null
				&& request.getParameter("Release") == null
				&& request.getParameter("CriticRating") == null
				&& request.getParameter("Awards") != null)
		{
			pw.println("<tr><td>TITLE</td><td>COMPANY</td><td>AWARD</td><td>AWARD YEAR</td></tr>"
					+ "<tr><td>------------</td><td>------------</td><td>------------</td><td>------------</td></tr>");
			switch (platformFlag) {
			case 0:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, a.awardName, a.year from VideoGame v, Awards a where v.title = a.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 1:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, a.awardName, a.year from VideoGame v, Awards a, MadeFor m where v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, a.awardName, a.year from VideoGame v, Awards a, MadeFor m where v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 3:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, a.awardName, a.year from VideoGame v, Awards a, MadeFor m where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
					"INTERSECT select v2.title, v2.compName, a2.awardName, a2.year from VideoGame v2, MadeFor m2, Awards a2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, v2.compName, a2.awardName, a2.year from VideoGame v2, MadeFor m2, Awards a2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, v2.compName, a2.awardName, a2.year from VideoGame v2, MadeFor m2, Awards a2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title, v2.compName, a2.awardName, a2.year from VideoGame v2, MadeFor m2, Awards a2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, a.awardName, a.year from VideoGame v, Awards a where v.title = a.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = v.title and e.maturity = 'MATURE'");
				break;
			}
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td><td>" + rset.getString("compName") + "</td><td>" + rset.getString("awardName") + "</td><td>" + rset.getInt("year") + "</td></tr>");
			}
		}
		
		
		
		//TITLE, COMPANY, CRITICRATING, AWARD
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") == null 
				&& request.getParameter("Company") != null
				&& request.getParameter("Release") == null
				&& request.getParameter("CriticRating") != null
				&& request.getParameter("Awards") != null)
		{
			pw.println("<tr><td>TITLE</td><td>COMPANY</td><td>CRITIC RATING</td><td>AWARD</td><td>AWARD YEAR</td></tr>"
					+ "<tr><td>------------</td><td>------------</td><td>------------</td><td>------------</td><td>------------</td></tr>");
			switch (platformFlag) {
			case 0:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore, a.awardName, a.year from VideoGame v, CriticRating c, Awards a where v.title = a.title and c.title = v.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where v.title = a.title and c.title = v.title and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where v.title = a.title and c.title = v.title and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where v.title = a.title and c.title = v.title and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 1:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, CriticRating c, Awards a where v.title = a.title and c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where v.title = a.title and c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where v.title = a.title and c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where v.title = a.title and c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, CriticRating c, Awards a where v.title = a.title and c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where v.title = a.title and c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where v.title = a.title and c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where v.title = a.title and c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 3:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, CriticRating c, Awards a where v.title = a.title and c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
					"INTERSECT select v2.title, v2.compName, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = a2.title and v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where v.title = a.title and c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, v2.compName, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = a2.title and v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where v.title = a.title and c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, v2.compName, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = a2.title and v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where v.title = a.title and c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title, v2.compName, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = a2.title and v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore, a.awardName, a.year from VideoGame v, CriticRating c, Awards a where v.title = a.title and c.title = v.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c where v.title = a.title and c.title = v.title and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c where v.title = a.title and c.title = v.title and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c where v.title = a.title and c.title = v.title and e.title = v.title and e.maturity = 'MATURE'");
				break;
			}
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td><td>" + rset.getString("compName") + "</td><td>" + rset.getDouble("compScore") + "</td><td>" + rset.getString("awardName") + "</td><td>" + rset.getInt("year") + "</td></tr>");
			}
		}
		
		
		
		
		//TITLE, COMPANY, RELEASE DATE, AWARD
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") == null 
				&& request.getParameter("Company") != null
				&& request.getParameter("Release") != null
				&& request.getParameter("CriticRating") == null
				&& request.getParameter("Awards") != null)
		{
			pw.println("<tr><td>TITLE</td><td>COMPANY</td><td>RELEASE DATE</td><td>AWARD</td><td>AWARD YEAR</td></tr>"
					+ "<tr><td>------------</td><td>------------</td><td>------------</td><td>------------</td><td>------------</td></tr>");
			switch (platformFlag) {
			case 0:
			if(ratingFlag == 0)
				rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a where v.title = a.title");
			else if(ratingFlag == 1)
				rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = t.title and e.maturity = 'EVERYO'");
			else if(ratingFlag == 2)
				rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = t.title and e.maturity = 'TEEN'");
			else if(ratingFlag == 3)
				rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = t.title and e.maturity = 'MATURE'");
				break;
				
			case 1:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m where v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'" +
							" and e.title = t.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'" +
					" and e.title = t.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'" +
					" and e.title = t.title and e.maturity = 'MATURE'");
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m where v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360'" +
							" and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360'" +
					" and e.title = v.title and e.maturity = 'TEEN'");	
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360'" +
					" and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 3:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
					"INTERSECT select v2.title, v2.compName, v2.releaseDate, a2.awardName, a2.year from VideoGame v2, Awards a2, MadeFor m2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, v2.compName, v2.releaseDate, a2.awardName, a2.year from VideoGame v2, Awards a2, MadeFor m2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, v2.compName, v2.releaseDate, a2.awardName, a2.year from VideoGame v2, Awards a2, MadeFor m2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title, v2.compName, v2.releaseDate, a2.awardName, a2.year from VideoGame v2, Awards a2, MadeFor m2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a where v.title = a.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = t.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = t.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = t.title and e.maturity = 'MATURE'");
				break;
				
			}
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td><td>" + rset.getString("compName") + "</td><td>" 
						+ rset.getInt("releaseDate") + "</td><td>" + rset.getString("awardName") + "</td><td>" + rset.getInt("year") + "</td></tr>");
			}
		}
		
		
		
		
		//TITLE, COMPANY, RELEASE, CRITICRATING, AWARD
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") == null 
				&& request.getParameter("Company") != null
				&& request.getParameter("Release") != null
				&& request.getParameter("CriticRating") != null
				&& request.getParameter("Awards") != null)
		{
			pw.println("<tr><td>TITLE</td><td>COMPANY</td><td>RELEASE DATE</td><td>CRITIC RATING</td><td>CRITIC RATING</td><td>AWARD YEAR</td></tr>"
					+ "<tr><td>------------</td><td>------------</td><td>------------</td><td>------------</td><td>------------</td><td>------------</td></tr>");
			switch (platformFlag) {
			case 0:
			if(ratingFlag == 0)
				rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, CriticRating c, Awards a where c.title = v.title and v.title = a.title");
			else if(ratingFlag == 1)
				rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and e.title = t.title and e.maturity = 'EVERYO'");
			else if(ratingFlag == 2)
				rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and e.title = t.title and e.maturity = 'TEEN'");
			else if(ratingFlag == 3)
				rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and e.title = t.title and e.maturity = 'MATURE'");
				break;
				
			case 1:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'" +
							" and e.title = t.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'" +
					" and e.title = t.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'" +
					" and e.title = t.title and e.maturity = 'MATURE'");
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360'" +
							" and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360'" +
					" and e.title = v.title and e.maturity = 'TEEN'");	
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360'" +
					" and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 3:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
					"INTERSECT select v2.title, v2.compName, v2.releaseDate, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = c2.title and v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, v2.compName, v2.releaseDate, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = c2.title and v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, v2.compName, v2.releaseDate, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = c2.title and v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title, v2.compName, v2.releaseDate, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = c2.title and v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, CriticRating c, Awards a where c.title = v.title and v.title = a.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and e.title = t.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and e.title = t.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and e.title = t.title and e.maturity = 'MATURE'");
				break;
				
			}
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td><td>" + rset.getString("compName") + "</td><td>" 
						+ rset.getInt("releaseDate") + "</td><td>" 
						+ rset.getDouble("compScore") + "</td><td>" + rset.getString("awardName") + "</td><td>" + rset.getInt("year") + "</td></tr>");
			}
		}
		
		
		
		//TITLE, GENRE, AWARD
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") != null 
				&& request.getParameter("Company") == null
				&& request.getParameter("Release") == null
				&& request.getParameter("CriticRating") == null
				&& request.getParameter("Awards") != null)
		{
			pw.println("<tr><td>TITLE</td><td>GENRE</td><td>AWARD</td><td>AWARD YEAR</td></tr>"
					+ "<tr><td>------------</td><td>------------</td><td>------------</td><td>------------</td></tr>");
			switch (platformFlag) {
			case 0:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, a.awardName, a.year from VideoGame v, Awards a where v.title = a.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and v.title = e.title AND e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and v.title = e.title AND e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and v.title = e.title AND e.maturity = 'MATURE'");
				break;
				
			case 1:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, a.awardName, a.year from VideoGame v, Awards a, MadeFor m where v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
				{
					rset = stmt.executeQuery("select v.title, v.genre, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'" +
							" v.title = e.title and e.maturity = 'EVERYO'");
				}
				else if(ratingFlag == 2)
				{
					rset = stmt.executeQuery("select v.title, v.genre, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'" +
					" v.title = e.title and e.maturity = 'TEEN'");
				}
				else if(ratingFlag == 3)
				{
					rset = stmt.executeQuery("select v.title, v.genre, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'" +
					" v.title = e.title and e.maturity = 'MATURE'");
				}
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, a.awardName, a.year from VideoGame v, Awards a, MadeFor m where v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
				{
					rset = stmt.executeQuery("select v.title, v.genre, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360'" +
					" v.title = e.title and e.maturity = 'EVERYO'");
				}
				else if(ratingFlag == 2)
				{
					rset = stmt.executeQuery("select v.title, v.genre, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360'" +
					" v.title = e.title and e.maturity = 'TEEN'");
				}
				else if(ratingFlag == 3)
				{
					rset = stmt.executeQuery("select v.title, v.genre, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360'" +
					" v.title = e.title and e.maturity = 'MATURE'");
				}
				break;
				
			case 3:
				if(ratingFlag == 0)
				{
					rset = stmt.executeQuery("select v.title, v.genre, a.awardName, a.year from VideoGame v, Awards a, MadeFor m where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
					"INTERSECT select v2.title, v2.genre, a2.awardName, a2.year from VideoGame v2, Awards a2, MadeFor m2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				}
				else if(ratingFlag == 1)
				{
					rset = stmt.executeQuery("select v.title, v.genre, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and v.title = e.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, v2.genre, a2.awardName, a2.year from VideoGame v2, Awards a2, MadeFor m2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				}
				else if(ratingFlag == 2)
				{
					rset = stmt.executeQuery("select v.title, v.genre, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and v.title = e.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, v2.genre, a2.awardName, a2.year from VideoGame v2, Awards a2, MadeFor m2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				}
				else if(ratingFlag == 3)
				{
					rset = stmt.executeQuery("select v.title, v.genre, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and v.title = e.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title, v2.genre, a2.awardName, a2.year from VideoGame v2, Awards a2, MadeFor m2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				}
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, a.awardName, a.year from VideoGame v, Awards a where v.title = a.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and v.title = e.title AND e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and v.title = e.title AND e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and v.title = e.title AND e.maturity = 'MATURE'");
				break;
			}
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td><td>" + rset.getString("genre") + "</td><td>" + rset.getString("awardName") + "</td><td>" + rset.getInt("year") + "</td></tr>");
			}
		}
		
		
		
		//TITLE, GENRE, CRITICRATING, AWARD
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") != null 
				&& request.getParameter("Company") == null
				&& request.getParameter("Release") == null
				&& request.getParameter("CriticRating") != null
				&& request.getParameter("Awards") != null)
		{
			pw.println("<tr><td>TITLE</td><td>GENRE</td><td>CRITIC RATING</td><td>AWARD</td><td>AWARD YEAR</td></tr>"
					+ "<tr><td>------------</td><td>------------</td><td>------------</td><td>------------</td><td>------------</td></tr>");
			switch (platformFlag) {
			case 0:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore, a.awardName, a.year from VideoGame v, CriticRating c, Awards a where c.title = v.title and v.title = a.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = e.title AND e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = e.title AND e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = e.title AND e.maturity = 'MATURE'");
				break;
				
			case 1:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
				{
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'" +
							" v.title = e.title and e.maturity = 'EVERYO'");
				}
				else if(ratingFlag == 2)
				{
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'" +
					" v.title = e.title and e.maturity = 'TEEN'");
				}
				else if(ratingFlag == 3)
				{
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'" +
					" v.title = e.title and e.maturity = 'MATURE'");
				}
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
				{
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360'" +
					" v.title = e.title and e.maturity = 'EVERYO'");
				}
				else if(ratingFlag == 2)
				{
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360'" +
					" v.title = e.title and e.maturity = 'TEEN'");
				}
				else if(ratingFlag == 3)
				{
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360'" +
					" v.title = e.title and e.maturity = 'MATURE'");
				}
				break;
				
			case 3:
				if(ratingFlag == 0)
				{
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
					"INTERSECT select v2.title, v2.genre, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = c2.title and v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				}
				else if(ratingFlag == 1)
				{
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and v.title = e.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, v2.genre, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = c2.title and v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				}
				else if(ratingFlag == 2)
				{
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and v.title = e.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, v2.genre, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = c2.title and v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				}
				else if(ratingFlag == 3)
				{
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and v.title = e.title and e.maturity = 'MATURITY'" +
					"INTERSECT select v2.title, v2.genre, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = c2.title and v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				}
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore, a.awardName, a.year from VideoGame v, CriticRating c, Awards a where c.title = v.title and v.title = a.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = e.title AND e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = e.title AND e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = e.title AND e.maturity = 'MATURE'");
				break;
			}
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td><td>" + rset.getString("genre") + "</td><td>" + rset.getDouble("compScore") + "</td><td>" + rset.getString("awardName") + "</td><td>" + rset.getInt("year") + "</td></tr>");
			}
		}
		
		
		
		//TITLE, GENRE, RELEASE DATE, AWARD
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") != null 
				&& request.getParameter("Company") == null
				&& request.getParameter("Release") != null
				&& request.getParameter("CriticRating") == null
				&& request.getParameter("Awards") != null)
		{
			pw.println("<tr><td>TITLE</td><td>GENRE</td><td>RELEASE DATE</td><td>AWARD</td><td>AWARD YEAR</td></tr>"
					+ "<tr><td>------------</td><td>------------</td><td>------------</td><td>------------</td><td>------------</td></tr>");
			//rset = stmt.executeQuery("select title, genre, releaseDate from VideoGame");
			switch (platformFlag) {
			case 0:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a where v.title = a.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a ESRBrating e where v.title = a.title and v.title = e.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a ESRBrating e where v.title = a.title and v.title = e.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a  ESRBrating e where v.title = a.title and v.title = e.title and e.maturity = 'MATURE'");
				break;
				
			case 1:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m where v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m where v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 3:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
					"INTERSECT select v2.title, v2.genre, v2.releaseDate, a2.awardName, a2.year from VideoGame v2, Awards a2, MadeFor m2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, v2.genre, v2.releaseDate, a2.awardName, a2.year from VideoGame v2, Awards a2, MadeFor m2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, v2.genre, v2.releaseDate, a2.awardName, a2.year from VideoGame v2, MadeFor m2, Awards a2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title, v2.genre, v2.releaseDate, a2.awardName, a2.year from VideoGame v2, Awards a2, MadeFor m2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a where v.title = a.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and v.title = e.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and v.title = e.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and v.title = e.title and e.maturity = 'MATURE'");
				break;
			}
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td><td>" + rset.getString("genre") +  "</td><td>" 
						+ rset.getInt("releaseDate") + "</td><td>" + rset.getString("awardName") + "</td><td>" + rset.getInt("year") + "</td></tr>");
			}
		}
		
		
		
		//TITLE, GENRE, RELEASE DATE, CRITICRATING, AWARD
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") != null 
				&& request.getParameter("Company") == null
				&& request.getParameter("Release") != null
				&& request.getParameter("CriticRating") != null
				&& request.getParameter("Awards") != null)
		{
			pw.println("<tr><td>TITLE</td><td>GENRE</td><td>RELEASE DATE</td><td>CRITIC RATING</td><td>AWARD</td><td>AWARD YEAR</td></tr>"
					+ "<tr><td>------------</td><td>------------</td><td>------------</td><td>------------</td><td>------------</td><td>------------</td></tr>");
			//rset = stmt.executeQuery("select title, genre, releaseDate from VideoGame");
			switch (platformFlag) {
			case 0:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, CriticRating c, Awards a where c.title = v.title and v.title = a.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = e.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = e.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = e.title and e.maturity = 'MATURE'");
				break;
				
			case 1:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and  v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and  v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and  v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, CriticRating c, Awards a where c.title = v.title and v.title = a.title and  v.title = m.title and m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and  v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and  v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and  v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 3:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, CriticRating c, Awards a where c.title = v.title and v.title = a.title and  v.title = m.title AND m.consoleName = 'Xbox 360'" +
					"INTERSECT select v2.title, v2.genre, v2.releaseDate, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = c2.title and v2.title = a2.title and  v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and  v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, v2.genre, v2.releaseDate, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = c2.title and v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and  v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, v2.genre, v2.releaseDate, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = c2.title and v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and  v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title, v2.genre, v2.releaseDate, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2, where v2.title = c2.title and v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, CriticRating c, Awards a where c.title = v.title and v.title = a.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = e.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = e.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = e.title and e.maturity = 'MATURE'");
				break;
			}
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td><td>" + rset.getString("genre") + "</td><td>" 
						+ rset.getInt("releaseDate") + "</td><td>" + rset.getDouble("compScore") + "</td><td>" + rset.getString("awardName") + "</td><td>" + rset.getInt("year") + "</td></tr>");
			}
		}
		
		
		
		//TITLE, GENRE, COMPANY, AWARD
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") != null 
				&& request.getParameter("Company") != null
				&& request.getParameter("Release") == null
				&& request.getParameter("CriticRating") == null
				&& request.getParameter("Awards") != null)
		{
			pw.println("<tr><td>TITLE</td><td>GENRE</td><td>COMPANY</td><td>AWARD</td><td>AWARD YEAR</td></tr>"
					+ "<tr><td>------------</td><td>------------</td><td>------------</td><td>------------</td><td>------------</td></tr>");
			switch (platformFlag) {
			case 0:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, a.awardName, a.year from VideoGame v, Awards a where v.title = a.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, a.awardName, a.year from VideoGame v, Awards a, ESRBRating e where v.title = a.title and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, a.awardName, a.year from VideoGame v, Awards a, ESRBRating e where v.title = a.title and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, a.awardName, a.year from VideoGame v, Awards a, ESRBRating e where v.title = a.title and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 1:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, a.awardName, a.year from VideoGame v, Awards a, MadeFor m where v.title = m.title and v.title = a.title and m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = m.title and v.title = a.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = m.title and v.title = a.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = m.title and v.title = a.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, a.awardName, a.year from VideoGame v, Awards a, MadeFor m where v.title = m.title and v.title = a.title and m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = m.title and v.title = a.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = m.title and v.title = a.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = m.title and v.title = a.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 3:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title , v.genre, v.compName, a.awardName, a.year from VideoGame v, Awards a, MadeFor m where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
					"INTERSECT select v2.title, v2.genre, v2.compName, a2.awardName, a2.year from VideoGame v2, MadeFor m2, Awards a2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title , v.genre, v.compName, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, v2.genre, v2.compName, a2.awardName, a2.year from VideoGame v2, MadeFor m2, Awards a2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title , v.genre, v.compName, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, v2.genre, v2.compName, a2.awardName, a2.year from VideoGame v2, MadeFor m2, Awards a2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title , v.genre, v.compName, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title, v2.genre, v2.compName, a2.awardName, a2.year from VideoGame v2, MadeFor m2, Awards a2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, a.awardName, a.year from VideoGame v, Awards a where  v.title = a.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, a.awardName, a.year from VideoGame v, Awards a, ESRBRating e where v.title = a.title and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, a.awardName, a.year from VideoGame v, Awards a, ESRBRating e where v.title = a.title and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, a.awardName, a.year from VideoGame v, Awards a, ESRBRating e where v.title = a.title and e.title = v.title and e.maturity = 'MATURE'");
				break;
			}
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td><td>" + rset.getString("genre") + "</td><td>" + rset.getString("compName") 
						+ "</td><td>" + rset.getString("awardName") + "</td><td>" + rset.getInt("year") + "</td></tr>");
			}
		}
		
		
		
		//TITLE, GENRE, COMPANY, RELEASE DATE, AWARD
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") != null 
				&& request.getParameter("Company") != null
				&& request.getParameter("Release") != null
				&& request.getParameter("CriticRating") == null
				&& request.getParameter("Awards") != null)
		{
			pw.println("<tr><td>TITLE</td><td>GENRE</td><td>COMPANY</td><td>RELEASE DATE</td><td>AWARD</td><td>AWARD YEAR</td></tr>"
					+ "<tr><td>------------</td><td>------------</td><td>------------</td><td>------------</td><td>------------</td><td>------------</td></tr>");
			switch (platformFlag) {
			case 0:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a where v.title = a.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 1:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m where v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m where v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 3:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
					"INTERSECT select v2.title, v2.genre, v2.compName, v2.releaseDate, a2.awardName, a2.year from VideoGame v2, Awards a2, MadeFor m2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, v2.genre, v2.compName, v2.releaseDate, a2.awardName, a2.year from VideoGame v2, Awards a2, MadeFor m2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, v2.genre, v2.compName, v2.releaseDate, a2.awardName, a2.year from VideoGame v2, Awards a2, MadeFor m2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, MadeFor m, ESRBrating e where v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title, v2.genre, v2.compName, v2.releaseDate, a2.awardName, a2.year from VideoGame v2, Awards a2, MadeFor m2 where v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a where v.title = a.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, a.awardName, a.year from VideoGame v, Awards a, ESRBrating e where v.title = a.title and e.title = v.title and e.maturity = 'MATURE'");
				break;
			}
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td><td>" + rset.getString("genre") + "</td><td>" 
						+ rset.getString("compName") + "</td><td>" + rset.getInt("releaseDate") + "</td><td>" + rset.getString("awardName") + "</td><td>" + rset.getInt("year") + "</td></tr>");
			}
		}
		
		
		
		//TITLE, GENRE, COMPANY, CRITICRATING, AWARD
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") != null 
				&& request.getParameter("Company") != null
				&& request.getParameter("Release") == null
				&& request.getParameter("CriticRating") != null
				&& request.getParameter("Awards") != null)
		{
			pw.println("<tr><td>TITLE</td><td>GENRE</td><td>COMPANY</td><td>CRITIC RATING</td><td>AWARD</td><td>AWARD YEAR</td></tr>"
					+ "<tr><td>------------</td><td>------------</td><td>------------</td><td>------------</td><td>------------</td></tr>");
			switch (platformFlag) {
			case 0:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore, a.awardName, a.year from VideoGame v, CriticRating c, Awards a where c.title = v.title and v.title = a.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore, a.awardName, a.year from VideoGame v, ESRBRating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore, a.awardName, a.year from VideoGame v, ESRBRating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore, a.awardName, a.year from VideoGame v, ESRBRating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 1:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 3:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title , v.genre, v.compName, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
					"INTERSECT select v2.title, v2.genre, v2.compName, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = c2.title and v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title , v.genre, v.compName, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, v2.genre, v2.compName, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = c2.title and v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title , v.genre, v.compName, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, v2.genre, v2.compName, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = c2.title and v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title , v.genre, v.compName, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title, v2.genre, v2.compName, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = c2.title and v2.title = a2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore, a.awardName, a.year from VideoGame v, CriticRating c, Awards a where c.title = v.title and v.title = a.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore, a.awardName, a.year from VideoGame v, ESRBRating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore, a.awardName, a.year from VideoGame v, ESRBRating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, c.compScore, a.awardName, a.year from VideoGame v, ESRBRating e, CriticRating c, Awards a where c.title = v.title and v.title = a.title and e.title = v.title and e.maturity = 'MATURE'");
				break;
			}
			while (rset.next()) {
				pw.println ("<tr><td>" + rset.getString("title") + "</td><td>" + rset.getString("genre") + "</td><td>" + rset.getString("compName") 
						+ "</td><td>" + rset.getDouble("compScore") + "</td><td>" + rset.getString("awardName") + "</td><td>" + rset.getInt("year") + "</td></tr>");
			}
		}
		
		//TITLE, GENRE, COMPANY, RELEASE DATE, CRITICRATING, AWARD
		else if(request.getParameter("Title") != null 
				&& request.getParameter("Genre") != null 
				&& request.getParameter("Company") != null
				&& request.getParameter("Release") != null
				&& request.getParameter("CriticRating") != null
				&& request.getParameter("Awards") != null)
		{
			pw.println("<tr><td>TITLE</td><td>GENRE</td><td>COMPANY</td><td>RELEASE DATE</td><td>CRITIC RATING</td><td>AWARD</td><td>AWARD YEAR</td></tr>"
					+ "<tr><td>------------</td><td>------------</td><td>------------</td><td>------------</td><td>------------</td><td>------------</td><td>------------</td></tr>");
			switch (platformFlag) {
			case 0:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, CriticRating c, Awards a where v.title = a.title and c.title = v.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where v.title = a.title and c.title = v.title and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where v.title = a.title and c.title = v.title and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where v.title = a.title and c.title = v.title and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 1:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, CriticRating c, Awards a where v.title = a.title and c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where v.title = a.title and c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where v.title = a.title and c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where v.title = a.title and c.title = v.title and v.title = m.title and m.consoleName = 'Playstation 3' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 2:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, CriticRating c, Awards a where v.title = a.title and c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where v.title = a.title and c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where v.title = a.title and c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where v.title = a.title and c.title = v.title and v.title = m.title and m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'");
				break;
				
			case 3:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, CriticRating c, Awards a where v.title = a.title and c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360'" +
					"INTERSECT select v2.title, v2.genre, v2.compName, v2.releaseDate, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = a2.title and v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where v.title = a.title and c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'EVERYO'" +
					"INTERSECT select v2.title, v2.genre, v2.compName, v2.releaseDate, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = a2.title and v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where v.title = a.title and c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'TEEN'" +
					"INTERSECT select v2.title, v2.genre, v2.compName, v2.releaseDate, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = a2.title and v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, MadeFor m, ESRBrating e, CriticRating c, Awards a where v.title = a.title and c.title = v.title and v.title = m.title AND m.consoleName = 'Xbox 360' and e.title = v.title and e.maturity = 'MATURE'" +
					"INTERSECT select v2.title, v2.genre, v2.compName, v2.releaseDate, c2.compScore, a2.awardName, a2.year from VideoGame v2, MadeFor m2, CriticRating c2, Awards a2 where v2.title = a2.title and v2.title = c2.title and v2.title = m2.title AND m2.consoleName = 'Playstation 3'");
				break;
				
			default:
				if(ratingFlag == 0)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, CriticRating c, Awards a where v.title = a.title and c.title = v.title");
				else if(ratingFlag == 1)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where v.title = a.title and c.title = v.title and e.title = v.title and e.maturity = 'EVERYO'");
				else if(ratingFlag == 2)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where v.title = a.title and c.title = v.title and e.title = v.title and e.maturity = 'TEEN'");
				else if(ratingFlag == 3)
					rset = stmt.executeQuery("select v.title, v.genre, v.compName, v.releaseDate, c.compScore, a.awardName, a.year from VideoGame v, ESRBrating e, CriticRating c, Awards a where v.title = a.title and c.title = v.title and e.title = v.title and e.maturity = 'MATURE'");
				break;
			}
			while (rset.next()) {
				pw.println ("<tr><td>" +rset.getString("title") + "</td><td>" + rset.getString("genre") + "</td><td>" 
						+ rset.getString("compName") + "</td><td>" + rset.getInt("releaseDate") + "</td><td>" + rset.getDouble("compScore") + "</td><td>" + rset.getString("awardName") + "</td><td>" + rset.getInt("year") + "</td></tr>");
			}
		}
		
		//NOTHING
		else if(request.getParameter("Title") == null 
				&& request.getParameter("Genre") == null 
				&& request.getParameter("Company") == null
				&& request.getParameter("Release") == null
				&& request.getParameter("CriticRating") == null
				&& request.getParameter("Awards") == null)
		{
			//while (rset.next()) {
				pw.println ("Nothing was requested!");
			//}
		}
		pw.println("</TABLE></body></html>");
	} catch (SQLException e) {
		pw.println(e.getMessage());
	}
pw.close();
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
}
}